package com.amit.servlet;

import java.util.ArrayList;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class MyContextListener  implements ServletContextListener{
	

	ServletContext context=null;
	@Override
	public void contextInitialized(ServletContextEvent sce) {
		
		
		context=sce.getServletContext();
		ArrayList al=new ArrayList();
		al.add("Head First Java");
		al.add("Head First Servlet");
		al.add("Head First EJB");
		al.add("Mastering Java");
		al.add("Mastering Servlet");
		al.add("Mstering JSP");
		
		context.setAttribute("Book", al);
		Integer i=new Integer(0);
		context.setAttribute("TV", i);
		context.setAttribute("CO", i);	
		
	}
	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		
		System.out.println("Context Destroyed");
	
		
	}
	
}
